import os

import pytest
from loguru import logger

from cases.case_auth import AuthCase
from common.handle_mysql import HandleMysql
from common.handle_redis import HandleRedis
from common.utils import Utils


# ma = MemberApi()


# @pytest.fixture(scope='class')
# def get_login_data():
#     """获取登录数据"""
#     data = MemberApi().get_login_data()
#     return data


@pytest.fixture(scope='class')
def connect_redis(request):
    """连接Redis"""
    rediscon = HandleRedis(**request.param)
    yield rediscon


@pytest.fixture(scope='class')
def connect_mysql(request):
    """连接数据库"""
    db = HandleMysql(**request.param)
    yield db
    db.close()


@pytest.fixture(scope='session', autouse=True)
def task_mark():
    logger.debug("{:=^50}".format('测试任务开始'))
    yield
    logger.debug("{:=^50}".format('测试任务结束'))


@pytest.fixture(autouse=True)
def case_mark():
    logger.debug("{:=^50}".format('测试用例开始'))
    yield
    logger.debug("{:=^50}".format('测试用例结束'))


